using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WPGame.Graphics;

namespace WPGame.ResourceManager
{
    class GSpriteFactory
    {
        private static GSpriteFactory m_Inst;
        public static GSpriteFactory getInstance()
        {
            if (m_Inst == null)
                m_Inst = new GSpriteFactory();
            return m_Inst;
        }
        private GSpriteFactory() { }

        // All Sprite in Game
        private Sprite m_PlayButton;
        private Sprite m_Background;
        private Sprite m_InfoButton;
        private Sprite m_HelpButton;
        private Sprite m_OptionButton;
        private Sprite m_SelectButton;

            //Draft
        private Sprite m_LotusLeaf;
        // End All Sprite

        // All SpriteFont in Game
        private SpriteFont ArialFont;
        // End All SpriteFont

        // Ham nay dung tam thoi`. De opt game thi phai phan chia theo tung State
        public void Init(ContentManager Content)
        {
            // Init Sprite

            m_Background = new Sprite(Content, @"Resources\\Background\\Background");
            m_HelpButton = new Sprite(Content, @"Resources\\Buttons\\MoreGameButton");
            m_InfoButton = new Sprite(Content, @"Resources\\Buttons\\InfoButton");
            m_OptionButton = new Sprite(Content, @"Resources\\Buttons\\OptionButton");
            m_PlayButton = new Sprite(Content, @"Resources\\Buttons\\PlayButton");
            m_SelectButton = new Sprite(Content, @"Resources\\Buttons\\SelectLevelButton");

            //Draft
            m_LotusLeaf = new Sprite(Content, @"Draft\\FourDir", 1, new Rectangle(0, 0, 59, 59));

            // Init SpriteFont
            ArialFont = Content.Load<SpriteFont>(@"Font\\ArialFont");
        }

        public Sprite getSprite(eGSprite e)
        {
            switch (e)
            {
                case eGSprite.PLAY_BUTTON:
                    return m_PlayButton;
                case eGSprite.BACKGROUND:
                    return m_Background;
                case eGSprite.MORE_BUTTON:
                    return m_HelpButton;
                case eGSprite.INFO_BUTTON:
                    return m_InfoButton;
                case eGSprite.OPTION_BUTTON:
                    return m_OptionButton;
                case eGSprite.SELECT_LEVEL_BUTTON:
                    return m_SelectButton;

                case eGSprite.FOURDIR:
                    return m_LotusLeaf;
                default: 
                    return null;
            }
        }
        public SpriteFont getFont(eGFont e)
        {
            switch (e)
            {
                case eGFont.ARIAL_FONT:
                    return ArialFont;
                default:
                    return null;
            }
        }
    }
}
